package com.lv.phuotbacnam.bl.network.util;

import android.content.Context;
import android.net.ConnectivityManager;

import com.lv.phuotbacnam.OurApplication;

/**
 * Connection related utility methods
 */
public class ConnectionHelper {

    /**
     * Check if the device is connected to the internet
     * @return true if connection available
     */
    public static boolean isConnectionAvailable(){
        ConnectivityManager connectivityManager = (ConnectivityManager) OurApplication.getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        return connectivityManager.getActiveNetworkInfo() != null
                && connectivityManager.getActiveNetworkInfo().isConnectedOrConnecting();
    }
}
